fix: assign Location.physicalType codes to the correct PL/LA2 components - #53
Merged
Conversation
toLocationFromComposite held the IG's component mapping in an array it never read, so every physical-type code landed on the wrong component: a Point of Care came out bd/Bed, a Facility lvl/Level, and Building and Floor were never read at all. The eHealth Exchange review caught it on a Nevada Z42 -- codes we invented, plus a Building the message did send that never appeared. Each component now gets its IG code (bd Bed, ro Room, si Facility, bu Building, lvl Floor). Point of Care gets none: R4's location-physical-type has no code for one, and the old wa/Ward was a guess. Components 9 and 10 are read per datatype, so a PL keeps PL-9 as description instead of PL-10's identifier text, and an LA1/LA2 stops copying its street address there. BREAKING for Location consumers. 2.5.2-SNAPSHOT for pilot testing, releasing as 2.6.0. Adds LocationCompositeTests, 12 tests where Location had no coverage.
The design and the location-composite-conversion spec said `wa`/Ward was invented data. `wa` is a real code in FHIR R4's location-physical-type code system; what has no basis is assigning it to PL/LA1/LA2-1 Point of Care, which the v2-to-FHIR IG leaves unresolved by naming an extension rather than a code. Emitting it asserts a physical type the sending system never sent, which is the actual defect the eHealth Exchange review reported. Both files now lead with the IG's unresolved cell, then note that no concept in location-physical-type describes a point of care, and record that Location.physicalType is 0..1 so a Location without one is conformant. The spec scenario is retitled from "invented" to "substituted" to match. Wording only; no behavior, no code, no test changes.
Move the change to openspec/changes/archive/2026-08-17-fix-pilot-fhir-conformance-defects and promote its location-composite-conversion delta to a main spec. The spec contracts how PL, LA1 and LA2 become Location: which component names each Location, the physicalType code per component from the IG's datatype-pl-to-location ConceptMap, no code for Point of Care, the partOf nesting order, Location Status and Person Location Type as operationalStatus and type, and which element components 9 and beyond supply per datatype. All 22 tasks complete; 24529 tests pass.
austinmoody
marked this pull request as ready for review
August 18, 2026 01:23
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



toLocationFromCompositedeclared the IG's component order but never used it:Loop walked components 1–6 in order, handed out codes in mapped order. Result: wrong
physicalTypeon nearly every Location, PL-5/PL-6 could become bogus Locations, and Building/Floor (components 7–8) were never read at all.Found by eHealth Exchange pilot conformance review of a Nevada Z42: "extra data not returned in the Z42: physicalType: BD Bed, lvl Level".
Before / after
Reviewed
RXA-11, converted through the Transformation Service:bd/Bed + duplicatedescriptionphysicalType(IG maps none; R4 has no code for it)bu/Buildinglvl/Levelsi/SiteChanges
LOC_COMPONENTS,LOC_CODES,LOC_DISPLAYS); loop indexes by it.physicalType— IG cell unresolved,physicalTypeis0..1, omitting is conformant. Oldwa/Ward had no basis in the IG.PLgetsdescription(PL-9) andidentifier(PL-10);LA1/LA2get neither (theirs are the address, already onLocation.address).LocationCompositeTests— 12 tests incl. the reviewedRXA-11.Locationhad zero coverage before.Sources
partOfnestingTesting
mvn clean install— 24529 tests, 0 failures (baseline 24517; delta = the 12 new tests). Verified end to end viaizgw-transformon the reviewed Nevada Z42. Carried on2.5.2-SNAPSHOT, releases as2.6.0. OpenSpec:openspec/changes/fix-pilot-fhir-conformance-defects/.